﻿using Core.MessageEvent;
using Microsoft.Research.DynamicDataDisplay;
using Prism.Events;
using System.Windows;
using System.Windows.Controls;

namespace ProcessControl.Views
{
    /// <summary>
    /// HomePageView.xaml 的交互逻辑
    /// </summary>
    public partial class HomePageView : UserControl
    {
        public HomePageView(IEventAggregator ea)
        {
            InitializeComponent();
            //取消鼠标右键弹出的菜单栏
            ch1.Children.Remove(ch1.DefaultContextMenu);
            //取消鼠标拖动及缩放绘图仪
            ch1.Children.Remove(ch1.MouseNavigation);
            ea.GetEvent<ChartPlotterEvent>().Subscribe(Receive, ThreadOption.UIThread, false);
        }

        private void Receive(ulong i)
        {
            if (i > 40)
            {
                ch1.Visible = new Rect(i - 40, 0, 40, 100);
                //ch1.SaveScreenshot("D:\\桌面\\"+i.ToString()+"\\Sc.png");
            }
        }
    }
}
